<?php
/**
 * Created by PhpStorm.
 * User: zhangbing
 * Date: 2017/5/20
 * Time: 16:16
 */
namespace app\admin\validate;
use think\Validate;

class User extends Validate{
    //定义验证规则
    protected $rule = [
        'name'     => 'require|unique:business',
        'location' => 'require|unique:business',
    ];

    //定义错误信息
    protected $message = [
        'name.require' => '名称不能为空',
        'name.unique'  => '名称不能重复',
        'location.require' => '地址不能为空',
        'location.unique'  => '地址不能重复',
    ];

    //验证场景
    protected $scene = [
        'businessAdd'  =>  ['name','location'],
        'businessSave' =>  ['name','location'],
    ];
}
